package com.shopping_back.controller;

import com.shopping_back.common.Result;
import com.shopping_back.service.IComboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/combo")
public class ComboController {

    @Autowired
    private IComboService comboService;

    @GetMapping("/activity")
    public Result getComboActivity(@RequestParam Long activityId) {
        return Result.success(comboService.getComboActivity(activityId));
    }

    @GetMapping("/items")
    public Result getComboItems(@RequestParam Long activityId, @RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
        return comboService.getComboItems(activityId, page, size);
    }

    @PostMapping("/placeOrder")
    public Result placeComboOrder(@RequestParam Long userId, @RequestParam Long activityId, @RequestParam Long comboId) {
        return comboService.placeComboOrder(userId, activityId, comboId);
    }
}
